import axios from 'axios'

// 请求拦截器
import store from '../store/index.js'
const request = axios.create({
  // baseURL: 'http://toutiao-app.itheima.net'
  baseURL: 'http://192.168.15.28:8000'

})
request.interceptors.request.use(function (config) {
  // console.log('config', config)
  const token = store.state.list.token
  if (token) {
    config.headers.Authorization = `Bearer ${token}`
  }
  return config
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})
export default request
